package com.itheima.mysort;

public class A02_SelectionDemo1 {
    public static void main(String[] args) {
        //选择排序
        int[] arr = {4, 2, 1, 3, 7, 10, 5, 8, 9, 6};

        //拿着第一组的数据跟后面的一一比较
        for (int i = 0; i < arr.length-1; i++) {
            for (int j = i+1; j < arr.length; j++) {
                //判断
                if(arr[i] > arr[j]) {
                    int temp = arr[i];
                    arr[i] = arr[j];
                    arr[j] = temp;
                }
            }
        }
        for (int i = 0; i < arr.length; i++) {
            System.out.print(arr[i]+" ");
        }


    }
}
